package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

/**
 * 转换流-OutputStreamWriter
 */
public class OutputStreamWriter_ {

    public static void main(String[] args) throws Exception {
        /*
            将字节流 FileOutputStream 转换成 字符流 OutputStreamWriter
            对文件进行写入(gbk格式)
         */

        OutputStreamWriter osw =
                new OutputStreamWriter(new FileOutputStream("D:\\IdeaCode\\javaStudy\\b.txt"), "gbk");

        //写入
        osw.write("你好...");
        //关闭
        osw.close();
        System.out.println("保存成功...");
    }
}
